--[[
* 能量变更后
*]]
---@class BuffEffect77 : BaseBuffEffect
BuffEffect77 = ClientFight.CreateClass("BuffEffect77", ClientFight.BaseBuffEffect)
local t = BuffEffect77
---@param fight Fight
---@param buff FighterBuff

function t:action(fight, buff, ...)
    local buffEffectValue = buff.buffBean.f_BuffEffectValue;
    local radis = buffEffectValue[1];
    local teamIndex = buffEffectValue[2] == 1 and 1 - buff.target.teamIndex or buff.target.teamIndex;
    local source = buffEffectValue[3] == 1 and buff.source or buff.target;
    local fighters = clone(fight.teams[teamIndex].fighters);
    for k, fighter in pairs(fighters) do
        local is = true;
        if (fighter:isSummons() and not fighter.isRealSummons()) then
            is = false;
        end
        if (fighter:isDie()) then
            is = false;
        end
        if (fighter == buff.target) then
            is = false;
        end
        if is then
            local distance = DistanceUtil.countDistance(fighter.position, buff.target.position);
            if (distance * Global.TEN_THOUSANDTH <= radis) then
                SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff" .. buff.modelId .. " 触发给周围人增加buff: " .. buffEffectValue[4]);
                ClientFight.BuffManager.addBuff(fight, buff.skill, source, fighter, false, buffEffectValue[4], 1);
            end
        end
    end
    return IBuffEffect.FAIL;
end

t.New()